
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:p="http://primefaces.org/ui"
        xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
        <title>Admin Panel</title>
</h:head>
<h:body style="background:#2A2D30;">

<h:form>
<p:panel style="height:400px">
                <p:panel header="New Hotel Form">
                        <h:panelGrid columns="3" id="add_hotelGrid">
                                <h:outputLabel for="hCity">City:</h:outputLabel>
                                <p:inputText id="hCity" value="#{hotelbean.hoteldto.hCity}" />
                                <p:message for="hCity" />



                                <h:outputLabel for="hName">Hotel Name:</h:outputLabel>
                                <p:inputText id="hName"
                                        value="#{hotelbean.hoteldto.hName}" />
                                <p:message for="hName" />

                                <h:outputLabel for="hCost">Cost per Night:</h:outputLabel>
                                <p:inputText id="hCost" value="#{hotelbean.hoteldto.hCost}" />
                                <p:message for="hCost" />
                                                       

                        </h:panelGrid>
                        <p:commandButton id="addhotel" value="Add Hotel"
                                update="add_hotelGrid,successDlg" title="Complete"
                                action="#{hotelbean.register()}"
                                oncomplete="PF('successDialog').show()" />

                </p:panel>
                <p:dialog header="Status" widgetVar="successDialog" resizable="false"
                        id="successDlg" showEffect="fade" hideEffect="drop" modal="true"
                        draggable="no">

                        <h:outputText rendered="#{(empty hotelbean.hoteldto.hName)}"
                                value="Error!No data added" />

                        <p:panel rendered="#{(not empty hotelbean.hoteldto.hName)}">
                                <h:panelGrid columns="3">
                                        <h:outputText value="The Hotel: '"></h:outputText>
                                        <h:outputText value="#{(hotelbean.hoteldto.hName)}" />
                                        <h:outputText value="' is  added successfully" />
                                </h:panelGrid>
                        </p:panel>
                        <h:form>
                                <br />
                                <p:button value="OK!"
                                        outcome="hotel.xhtml" />
                              
                         </h:form>
                </p:dialog>
                <p:panel>
      <p:button value="back" outcome="index.xhtml" />
                </p:panel>
</p:panel>
        </h:form>
        
</h:body>
</html>